package com.example.zjsr.dao.knowledge;

import com.example.zjsr.domain.Admin.knowledge.Knowledge;
import com.example.zjsr.domain.Admin.knowledge.KnowledgeAnswer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author lvyongwei
 */
@Mapper
public interface KnowledgeMapper {

    /**
     * 添加知识互动内容
     * @param knowledge
     * @return
     */
    public boolean addKnowledge(Knowledge knowledge);

    /**
     * 修改知识互动内容
     * @param knowledge
     * @return
     */
    public boolean updateKnowledge(Knowledge knowledge);

    /**
     * 根据知识互动id删除对应的答案
     * @param knowledgeId
     * @return
     */
    public boolean deleteKnowledgeAnswer(Integer knowledgeId);

    /**
     * 添加知识互动下的回答
     * @param answers
     * @param knowledgeId
     * @return
     */
    public boolean insertKnowledgeAnswer(@Param("knowledgeId") Integer knowledgeId, @Param("list") List<KnowledgeAnswer> answers);

    /**
     * 查询所有知识互动内容
     * @param headLineId
     * @return
     */
    public List<Knowledge> selectKnowledge(Integer headLineId);

    /**
     * 根据知识id查询所有答案
     * @param knowledgeId
     * @return
     */
    public List<KnowledgeAnswer> selectKnowledgeAnswer(Integer knowledgeId);
}
